package com.sdssm.ajax;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

@WebServlet(urlPatterns = "/registerServlet")
public class RegisterServlet extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        request.setCharacterEncoding("utf-8");
        response.setCharacterEncoding("utf-8");

        // 获得表单提交用户名与密码
        String username = request.getParameter("username");
        String pwd = request.getParameter("pwd");
        System.out.println(username+","+pwd);
        // 调用服务层的方法实现注册功能
        PrintWriter out = response.getWriter();
        out.print("用户名："+username);
        out.print("密码："+pwd);
        //out.close();
    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    }
}
